package fr.inserm.um915.bdibd.model;

import java.util.Collections;
import java.util.List;

import com.sleepycat.je.Transaction;

public abstract class DataExtractorFactory implements Cloneable
	{
	private Model model;
	private Transaction transaction;
	private float treshold;
	
	protected abstract class AbstractDataExtractor
		implements DataExtractor
		{
		private Model model;
		private Transaction transaction;
		private float treshold;
		private List<Integer> pairOfIndividuals=Collections.emptyList();
		
		
		
		@Override
		public void setPairOfIndividualIds( List<Integer> pairOfIndividuals)
			{
			this.pairOfIndividuals=Collections.unmodifiableList(pairOfIndividuals);
			}
		@Override
		public List<Integer> getPairOfIndividualIds()
			{
			return this.pairOfIndividuals;
			}
		void setModel(Model model)
			{
			this.model = model;
			}
		@Override
		public Model getModel()
			{
			return model;
			}
		void setTransaction(Transaction transaction) {
			this.transaction = transaction;
			}
		public Transaction getTransaction()
			{
			return transaction;
			}
		
		void setTreshold(float treshold)
			{
			this.treshold = treshold;
			}
		public float getTreshold()
			{
			return treshold;
			}
		
		@Override
		public DataExtractorFactory getFactory()
			{
			return DataExtractorFactory.this;
			}
		}
	
	
	protected DataExtractorFactory()
		{
		}
	
	protected DataExtractorFactory(DataExtractorFactory cp)
		{
		this.model=cp.model;
		this.transaction=cp.transaction;
		this.treshold=cp.treshold;
		}
	
	
	
	public abstract String getName();
	public  String getDescription()
		{
		return getName();
		}
	
	@Override
	public String toString()
		{
		return getName();
		}
	
	public Model getModel()
		{
		return model;
		}
	
	public void setModel(Model model)
		{
		this.model = model;
		}
	
	public Transaction getTransaction()
		{
		return transaction;
		}
	
	public void setTransaction(Transaction transaction)
		{
		this.transaction = transaction;
		}
	
	public void setTreshold(float treshold)
		{
		this.treshold = treshold;
		}
	
	public float getTreshold()
		{
		return treshold;
		}
	
	public WhichIBD getWichIBD()
		{
		return WhichIBD.USE_IBD_0;
		}
	
	public abstract DataExtractor createDataExtractor();
	@Override
	public abstract Object clone();
	}
